package org.jeecg.modules.xl.h5api.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.annotation.Export2Swagger;
import org.jeecg.modules.xl.h5api.service.IH5APIService;
import org.jeecg.modules.xl.h5api.vo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 门店端API
 *
 * @author deco
 * @create 2024-11-21
 */
@Api(tags="小程序订单接口")
@RestController
@RequestMapping("/slt/h5orderapi")
@Slf4j
public class H5APIOrderController {
    @Autowired
    private IH5APIService ih5APIService;

    /**
     *
     * @param listType  listType =1  预采购订单-未确认，listType=2 预采购订单-未确认 ，listType=3 预采购订单-未支付 ，listType=4 预采购订单-已支付 ，
     * @return
     */
    @ApiOperation(value = "获取订单列表", notes = "获取订单列表")
    @GetMapping(value = "/getOrderListByToken")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "listType", value = "列表类别", required = true, paramType = "query", dataType = "String")
    })
    public Result<List<OrderVO>> getOrderListByToken(@RequestParam(name = "listType", required = true) String listType) {
        return Result.OK(ih5APIService.getOrderListByToken(listType));
    }

    @ApiOperation(value = "获取订单详情", notes = "获取订单详情")
    @GetMapping(value = "/getOrderDetail")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "ordercode", value = "采购单号", required = true, paramType = "query", dataType = "String")
    })
    public Result<List<OrderDetailVo>> getOrderDetail(@RequestParam(name = "ordercode", required = true) String ordercode) {
        return Result.OK(ih5APIService.getOrderDetail(ordercode));
    }
    @ApiOperation(value = "获取订单的物流列表", notes = "获取订单的物流列表")
    @GetMapping(value = "/getLogiList")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "ordercode", value = "采购单号", required = true, paramType = "query", dataType = "String")
    })
    public Result<List<H5LogiVo>> getLogiList(@RequestParam(name = "ordercode", required = true) String ordercode) {
        return Result.OK(ih5APIService.getLogiList(ordercode));
    }
    @ApiOperation(value = "获取详情物流", notes = "获取详情物流")
    @GetMapping(value = "/getLogiDetail")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "logicode", value = "采购单号", required = true, paramType = "query", dataType = "String")
    })
    public Result<List<OrderDetailVo>> getLogiDetail(@RequestParam(name = "logicode", required = true) String logicode) {
        return null;//Result.OK(ih5APIService.getLogiDetail(logicode));
    }
}
